package com.shensiyuan.lesson3;

interface Shape {
	public void draw();
}

class Line implements Shape {
	public void draw() {
		System.out.println("line");
	}
}

class Square implements Shape {
	public void draw() {
		System.out.println("square");
	}
}

class Circle implements Shape {
	public void draw() {
		System.out.println("circle");
	}
}

class Painting {
	public static void main(String[] args) {
		Shape s1 = new Line();
		Shape s2 = new Square();
		Shape s3 = new Circle();
		paint(s1);
		paint(s2);
		paint(s3);
	}

	static void paint(Shape s) {
		if (s instanceof Line)
			s.draw();
		// more job here
		if (s instanceof Square)
			s.draw();
		// more job here
		if (s instanceof Circle)
			s.draw();
		// more job here
	}
}